package com.zhixin.zhixinmall.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import com.zhixin.zhixinmall.entity.pojo.JdGoodPromotion;
import com.zhixin.zhixinmall.service.JdGoodPromotionService;

/**
 * @author cyc
 * @date 2023/10/22 22:23:01
 */

@Service
public class JdGoodPromotionServiceImpl implements JdGoodPromotionService {
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public JdGoodPromotion insertJdGoodPromotion(JdGoodPromotion jdGoodPromotion) {
        return mongoTemplate.save(jdGoodPromotion);
    }

    @Override
    public JdGoodPromotion getJdGoodPromotionBySkuid(Long skuId) {
        return mongoTemplate.findOne(Query.query(Criteria.where("skuid").is(skuId)), JdGoodPromotion.class);
    }
}
